import Home from "@/views/Home.vue";
import Login from "@/views/Login.vue";
import ColumnDetail from "@/views/ColumnDetail.vue";
import CreatePost from "@/views/CreatePost.vue";
import Signup from "@/views/Signup.vue";
import PostDetail from "@/views/PostDetail.vue";
const routes = [
  {
    path: "/",
    name: "home",
    component: Home,
  },
  {
    path: "/login",
    name: "login",
    component: Login,
    meta: {
      redirectAlreadyLogin: true, // 已登录就跳转首页
    },
  },
  {
    path: "/column/:id",
    name: "column",
    component: ColumnDetail,
  },
  {
    path: "/create",
    name: "create",
    component: CreatePost,
    meta: {
      requiredLogin: true, // 当前页面需要登录才能进入
    },
  },
  {
    path: "/signup",
    name: "signup",
    component: Signup,
  },
  {
    path: "/post/:id",
    name: "post",
    component: PostDetail,
  },
];

export default routes;
